import librosa
import soundfile as sf

audio_path = './demo/test.mp3'
y, sr = librosa.load(audio_path, sr=48000)  # sr=None 保持原始采样率

# 变速处理，比如加速1.5倍
y_change = librosa.effects.time_stretch(y, rate=1.5)

# 保存
sf.write('output_audio_file.mp3', y_change, sr)